package com.douqu.game.core.entity.ext.data.challenge;

import com.bean.core.buffer.ByteBuffer;
import com.douqu.game.core.entity.EntityObject;

/**
 * @author: miralce.
 * Description:
 * Date: 2018/5/15 0015 下午 8:15
 * Huan Yu Copyright (c) 2017 All Rights Reserved.
 */
public class WorldMapTaskBean extends EntityObject {

    private Long complete;

    private int taskId;

    public WorldMapTaskBean(){

    }

    public WorldMapTaskBean(long l, int worldMapTaskKillGeneralFirstId) {
        WorldMapTaskData(Long.valueOf(l),worldMapTaskKillGeneralFirstId);
    }

    public void WorldMapTaskData(Long complete,int taskId){
        this.complete = complete;
        this.taskId = taskId;
    }

    public void writeTo(ByteBuffer buffer) {
        buffer.writeLong(complete);
        buffer.writeShort(taskId);
    }

    public void loadFrom(ByteBuffer buffer){
        complete = buffer.readLong();
        taskId = buffer.readShort();
    }


    public boolean isComplete(long need)
    {
        return complete >= need;
    }

    public void addComplete(long l){
        complete += l;
    }

    public Long getComplete() {
        return complete;
    }

    public void setComplete(Long complete) {
        this.complete = complete;
    }

    public int getTaskId() {
        return taskId;
    }

    public void setTaskId(int taskId) {
        this.taskId = taskId;
    }

    @Override
    public String toString() {
        return "WorldMapTaskData{" +
                "complete=" + complete +
                ", taskId=" + taskId +
                '}';
    }
}
